﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Model;

namespace DQYT.HTDZ.Web.BDPULL
{
    public partial class Modify : Page
    {       

        protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
				{
					decimal PULLID=(Convert.ToDecimal(Request.Params["id"]));
					ShowInfo(PULLID);
				}
			}
		}
			
	private void ShowInfo(decimal PULLID)
	{
		BDPULLBLL bll=new BDPULLBLL();
		BDPULLModel model=bll.GetModel(PULLID);
		this.lblPULLID.Text=model.PULLID.ToString();
		this.txtCYJXH.Text=model.CYJXH;
		this.txtCYJLB.Text=model.CYJLB;
		this.txtSCCJ.Text=model.SCCJ;
		this.txtXDEDZH.Text=model.XDEDZH.ToString();
		this.txtGGZDCC.Text=model.GGZDCC.ToString();
		this.txtGGZDCCI.Text=model.GGZDCCI.ToString();
		this.txtJSQEDNJ.Text=model.JSQEDNJ.ToString();
		this.txtJSQXSDH.Text=model.JSQXSDH;
		this.txtPHFS.Text=model.PHFS;
		this.txtLGC.Text=model.LGC.ToString();
		this.txtQBC.Text=model.QBC.ToString();
		this.txtHBC.Text=model.HBC.ToString();
		this.txtQBZL.Text=model.QBZL.ToString();
		this.txtQBZXBJ.Text=model.QBZXBJ.ToString();
		this.txtQBZX.Text=model.QBZX;
		this.txtPDXHGG.Text=model.PDXHGG;
		this.txtPHKSL.Text=model.PHKSL.ToString();
		this.txtJSB.Text=model.JSB.ToString();
		this.txtZJZL.Text=model.ZJZL.ToString();
		this.txtZJCC.Text=model.ZJCC.ToString();
		this.txtJNCYJ.Text=model.JNCYJ;
		this.txtSCFS.Text=model.SCFS;
		this.txtJXFLM.Text=model.JXFLM;
		this.txtISVALID.Text=model.ISVALID.ToString();
		this.txtISUSED.Text=model.ISUSED.ToString();
		this.txtBJ.Text=model.BJ;

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtCYJXH.Text.Trim().Length==0)
			{
				strErr+="CYJXH不能为空！\\n";	
			}
			if(this.txtCYJLB.Text.Trim().Length==0)
			{
				strErr+="CYJLB不能为空！\\n";	
			}
			if(this.txtSCCJ.Text.Trim().Length==0)
			{
				strErr+="SCCJ不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtXDEDZH.Text))
			{
				strErr+="XDEDZH格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtGGZDCC.Text))
			{
				strErr+="GGZDCC格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtGGZDCCI.Text))
			{
				strErr+="GGZDCCI格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtJSQEDNJ.Text))
			{
				strErr+="JSQEDNJ格式错误！\\n";	
			}
			if(this.txtJSQXSDH.Text.Trim().Length==0)
			{
				strErr+="JSQXSDH不能为空！\\n";	
			}
			if(this.txtPHFS.Text.Trim().Length==0)
			{
				strErr+="PHFS不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtLGC.Text))
			{
				strErr+="LGC格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtQBC.Text))
			{
				strErr+="QBC格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtHBC.Text))
			{
				strErr+="HBC格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtQBZL.Text))
			{
				strErr+="QBZL格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtQBZXBJ.Text))
			{
				strErr+="QBZXBJ格式错误！\\n";	
			}
			if(this.txtQBZX.Text.Trim().Length==0)
			{
				strErr+="QBZX不能为空！\\n";	
			}
			if(this.txtPDXHGG.Text.Trim().Length==0)
			{
				strErr+="PDXHGG不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtPHKSL.Text))
			{
				strErr+="PHKSL格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtJSB.Text))
			{
				strErr+="JSB格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtZJZL.Text))
			{
				strErr+="ZJZL格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtZJCC.Text))
			{
				strErr+="ZJCC格式错误！\\n";	
			}
			if(this.txtJNCYJ.Text.Trim().Length==0)
			{
				strErr+="JNCYJ不能为空！\\n";	
			}
			if(this.txtSCFS.Text.Trim().Length==0)
			{
				strErr+="SCFS不能为空！\\n";	
			}
			if(this.txtJXFLM.Text.Trim().Length==0)
			{
				strErr+="JXFLM不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtISVALID.Text))
			{
				strErr+="ISVALID格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtISUSED.Text))
			{
				strErr+="ISUSED格式错误！\\n";	
			}
			if(this.txtBJ.Text.Trim().Length==0)
			{
				strErr+="BJ不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			decimal PULLID=decimal.Parse(this.lblPULLID.Text);
			string CYJXH=this.txtCYJXH.Text;
			string CYJLB=this.txtCYJLB.Text;
			string SCCJ=this.txtSCCJ.Text;
			decimal XDEDZH=decimal.Parse(this.txtXDEDZH.Text);
			decimal GGZDCC=decimal.Parse(this.txtGGZDCC.Text);
			decimal GGZDCCI=decimal.Parse(this.txtGGZDCCI.Text);
			decimal JSQEDNJ=decimal.Parse(this.txtJSQEDNJ.Text);
			string JSQXSDH=this.txtJSQXSDH.Text;
			string PHFS=this.txtPHFS.Text;
			decimal LGC=decimal.Parse(this.txtLGC.Text);
			decimal QBC=decimal.Parse(this.txtQBC.Text);
			decimal HBC=decimal.Parse(this.txtHBC.Text);
			decimal QBZL=decimal.Parse(this.txtQBZL.Text);
			decimal QBZXBJ=decimal.Parse(this.txtQBZXBJ.Text);
			string QBZX=this.txtQBZX.Text;
			string PDXHGG=this.txtPDXHGG.Text;
			decimal PHKSL=decimal.Parse(this.txtPHKSL.Text);
			decimal JSB=decimal.Parse(this.txtJSB.Text);
			decimal ZJZL=decimal.Parse(this.txtZJZL.Text);
			decimal ZJCC=decimal.Parse(this.txtZJCC.Text);
			string JNCYJ=this.txtJNCYJ.Text;
			string SCFS=this.txtSCFS.Text;
			string JXFLM=this.txtJXFLM.Text;
			decimal ISVALID=decimal.Parse(this.txtISVALID.Text);
			decimal ISUSED=decimal.Parse(this.txtISUSED.Text);
			string BJ=this.txtBJ.Text;


			BDPULLModel model=new BDPULLModel();
			model.PULLID=PULLID;
			model.CYJXH=CYJXH;
			model.CYJLB=CYJLB;
			model.SCCJ=SCCJ;
			model.XDEDZH=XDEDZH;
			model.GGZDCC=GGZDCC;
			model.GGZDCCI=GGZDCCI;
			model.JSQEDNJ=JSQEDNJ;
			model.JSQXSDH=JSQXSDH;
			model.PHFS=PHFS;
			model.LGC=LGC;
			model.QBC=QBC;
			model.HBC=HBC;
			model.QBZL=QBZL;
			model.QBZXBJ=QBZXBJ;
			model.QBZX=QBZX;
			model.PDXHGG=PDXHGG;
			model.PHKSL=PHKSL;
			model.JSB=JSB;
			model.ZJZL=ZJZL;
			model.ZJCC=ZJCC;
			model.JNCYJ=JNCYJ;
			model.SCFS=SCFS;
			model.JXFLM=JXFLM;
			model.ISVALID=ISVALID;
			model.ISUSED=ISUSED;
			model.BJ=BJ;

			BDPULLBLL bll=new BDPULLBLL();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
